#ifndef TRAVERSE_DIR_H
#define TRAVERSE_DIR_H

#include <vector>
#include <string>
#ifdef   _WIN32
#include <io.h>
#include <sys/types.h>
#else
#include <dirent.h>
#endif

using namespace std;

#define _MAX_FNAME   256

struct dirent
{
    long  d_ino;
    off_t d_off;
    unsigned short d_reclen;
    char d_name[_MAX_FNAME+1];
};

struct DIR
{
    long  handle;
    short offset;
    short finished;
    struct _finddata_t fileinfo;
    char  *dir;
    struct dirent   dent;
};

struct DIR* opendir(const char*);
struct dirent* readdir(struct DIR*);
void closedir(struct DIR*);

int traverse_dir(string &path, vector<string>& files, const char *ext);

#endif
